import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { PagesComponent } from './pages.component';
import { NotFoundComponent } from './abnormal/not-found/not-found.component';
import { SalesWorkbenchComponent } from './sales-master/sales-workbench/sales-workbench.component';
import { AuthGuardService } from '../@core/services/auth-guard-service.guard';
import { CanActivateGuard  } from '../@core/services/can-load-service.guard';
const routes: Routes = [
  {
    path: '',
    component: PagesComponent,
    canActivate: [AuthGuardService, CanActivateGuard],
    children: [
      {
        path: 'abnormal',
        loadChildren: () =>
          import('./abnormal/abnormal.module').then((m) => m.AbnormalModule),
      },
      {
        path: 'systemset',
        loadChildren: () =>
          import('./systemset/systemset.module').then(m => m.SystemsetModule),
        canActivate: [CanActivateGuard],
      },
      {
        path: 'basicdata',
        loadChildren: () =>
          import('./basic-data/basic-data.module').then(m => m.BasicDataModule),
        canActivate: [CanActivateGuard]
      },
      {
        path: 'process',
        loadChildren: () =>
          import('./process/process.module').then((m) => m.ProcessModule),
        canActivate: [CanActivateGuard]
      },
      {
        path: 'device',
        loadChildren: () =>
          import('./device/device.module').then((m) => m.DeviceModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path: 'device-tools',
        loadChildren: () =>
          import('./device-tools/device-tools.module').then((m) => m.DeviceToolsModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path: 'mould',
        loadChildren: () =>
          import('./mould/mould.module').then((m) => m.MouldModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path: "product",
        loadChildren: () =>
          import('./product/product.module').then((m) => m.ProductModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path: "inventory",
        loadChildren: () =>
          import('./inventory/inventory.module').then((m) => m.InventoryModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path: "finance",
        loadChildren: () =>
          import('./finance/finance.module').then((m) => m.FinanceModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path: "sales-master",
        loadChildren: () =>
          import('./sales-master/sales-master.module').then((m) => m.SalesMasterModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path:'purchase',
        loadChildren: () =>
          import('./purchase/purchase.module').then((m) => m.PurchaseModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path:"kanban",
        loadChildren: () =>
          import('./kanban/kanban.module').then((m) => m.KanbanModule),
        canActivate: [CanActivateGuard ]
      },
      {
        path:'inspection',
        loadChildren: () =>
          import('./inspection/inspection.module').then((m) => m.InspectionModule),
      },
      {
        path: '**',
        component: NotFoundComponent,
      },
    ],
  },
];
@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class PagesRoutingModule { }
